package com.atxwq.shop.user.service.impl;

import com.atxwq.shop.model.entity.user.UserAddress;
import com.atxwq.shop.user.mapper.UserAddressMapper;
import com.atxwq.shop.user.service.UserAddressService;
import com.atxwq.utils.AuthContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description TODO
 * @Date 2025/5/23 10:53
 * @Created by 12336
 */

@Service
public class UserAddressServiceImpl implements UserAddressService {
    @Autowired
    private UserAddressMapper userAddressMapper;

    //获取用户地址列表

    @Override
    public List<UserAddress> findUserAddressList() {
        //获取当前用户id
        Long userId = AuthContextUtil.getUserInfo().getId();
        List<UserAddress> userAddresses =  userAddressMapper.getUserAddress(userId);

        return userAddresses;
    }

    /**
     * 远程调用
     * @param id
     * @return
     */
    @Override
    public UserAddress getById(Long id) {
        return userAddressMapper.getById(id);
    }
}
